﻿using Org.LyrcsoftFramework.Cloud.Core.Provider;
using Org.LyrcsoftFramework.Cloud.Extensions;
using System;
using System.Collections.Generic;
using System.Text;

namespace Org.LyrcsoftFramework.Cloud.Core
{
    public class ServiceFactory
    {
        private static readonly DefaultFeignServiceProvider serviceProvider = null;

        static ServiceFactory()
        {
            serviceProvider = new DefaultFeignServiceProvider();
        }

        public static void RegisterService<T>(T service)
        {
            serviceProvider.RegisterService<T>(service);
        }

        public static void RegisterService(Type typeInfo, Object service)
        {
            serviceProvider.RegisterService(typeInfo, service);
        }

        public static T GetService<T>(Type serviceType)
        {
            return (T)serviceProvider.GetService(serviceType);
        }

        public static T GetService<T>()
        {
            return (T)serviceProvider.GetService(typeof(T));
        }
    }
}
